extends FunctionCard

func _init() -> void:
	cost = 3
	card_id = "SaiWengShiMa"

func _ready() -> void:
	card_name = "塞翁失马"
	self_destruction = false
	self_description = "在全局游戏中，玩家每损失1枚金币，小顺子的倍率便会+1"
	trigger_timing = 1
	label.text = card_name
	self_descrpition_label.text = self_description

func cardFunction(deck,scoreMapping,selectedCardsDetail):
	if PlayerDetail.playerLostMoney > 0:
		scoreMapping.magnificationMapping.xiaoshun += PlayerDetail.playerLostMoney
		showRunDetail()
		run_detail.text = "顺子倍率+++"
		await get_tree().create_timer(0.5).timeout  # 等待0.5秒
		hideRunDetail()
	else:
		showRunDetail()
		run_detail.text = "未损失金币"
		await get_tree().create_timer(0.5).timeout  # 等待0.5秒
		hideRunDetail()
		
